<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
      <!-- 权限数据列表 -->
      <tree-table
        :data="categories"
        :columns="columns"
        :selection-type="false"
        :expand-type="false"
        show-index
        index-text="#"
        border
        :show-row-hover="false"
      >
        <template slot-scope="scope" slot="sort">
          <el-tag v-if="scope.row.level == 0">一级</el-tag>
          <el-tag type="success" v-if="scope.row.level == 1">二级</el-tag>
          <el-tag type="warning" v-if="scope.row.level == 2">三级</el-tag>
        </template>
      </tree-table>
    </el-card>
  </div>
</template>
<script>
import { getRightsAPI } from '@/api/rights'
export default {
  name: '',
  data () {
    return {
      list: [],
      categories: [],
      columns: [
        {
          label: '分类名称',
          prop: 'authName'
        },
        {
          label: '路径',
          prop: 'path'
        },
        {
          label: '权限等级',
          type: 'template',
          template: 'sort'
        },
      ],
    }
  },
  created () {
    this.getRights()
  },
  computed: {
  },
  methods: {
    async getRights () {
      const res = await getRightsAPI()
      console.log(res);
      this.categories = res.data
    }
  }
}
</script>
<style lang='less'  scoped>
</style>
